#include <dlib/queue.h>
#include <iostream>
#include <iomanip>
#include <ctime>
#include <cstdlib>
typedef dlib::queue<int>::sort_1b_c queue_of_int;
using namespace std;
using namespace dlib;


int main(){
    queue_of_int q;
    srand(time(0));

    for(int i=0; i<20; ++i){
        int a=rand()&0xFF;
        q.enqueue(a);
    }
    cout<<"The contents of the queue are:\n";
    while(q.move_next())
        cout<<q.element()<<" ";

    cout<<"\n\nNow we sort the queue and its contents are:\n";
    q.sort();
    while(q.move_next())
        cout<<q.element()<<" ";
    cout<<"\n\nNow we remove the numbers from the queue:\n";
    while(q.size()>0){
        int a;
        q.dequeue(a);
        cout<<a<<" ";
    }
    cout<<endl;
}